import request from '@/utils/request'

export const getGoodsList = (obj) => {
  return request.get('/goods/list', {
    params: {
      sortType: obj.sortType ? obj.sortType : 'all',
      sortPrice: obj.sortPrice,
      categoryId: obj.categoryId,
      goodsName: obj.goodsName,
      page: obj.page ? obj.page : 1
    }
  })
}

export const getGoodsDetail = (goodsId) => {
  return request.get('/goods/detail', {
    params: {
      goodsId
    }
  })
}

export const getGoodsService = (goodsId) => {
  return request.get('/goods.service/list', {
    params: { goodsId }
  })
}

export const getGoodsCommentListRows = (goodsId, limit) => {
  return request.get('/comment/listRows', {
    params: { goodsId, limit }
  })
}

export const getGoodsCommentList = (goodsId, scoreType, page) => {
  return request.get('/comment/list', {
    params: { goodsId, scoreType, page }
  })
}

export const getGoodsCommentTotal = (goodsId) => {
  return request.get('/comment/total', {
    params: { goodsId }
  })
}
